import numpy as np
import sys,os,glob
sys.path.append("..")
import segEvaluation_Func as eva
from paraClass import *
os.environ["CUDA_VISIBLE_DEVICES"] = "1"

organ = 'RatBrain'
stage = 'val'

imgpath = '/media/shuaiw/DataDisk/S_Wang_Research/P_Liming_RatBrain_Extraction/TrainData/Total_Mouth_Rat_Resampled/Raw' ## Resampled Intensity Image Folder
labelpath = '/media/shuaiw/DataDisk/S_Wang_Research/P_Liming_RatBrain_Extraction/TrainData/Total_Mouth_Rat_Resampled/Mask' ## Resampled Label Mask Folder
savepath = '/media/shuaiw/DataDisk/S_Wang_Research/P_Liming_RatBrain_Extraction/ModelOutput' ## Result Save Folder

"""Not change the following parameters"""
normparas = NormParas()
normparas.method = "minmax"

preparas = PreParas()
preparas.patchdims = [16,128,128]
preparas.patchlabeldims = [16,128,128]
preparas.patchstrides = [8,32,32]

preparas.organname = organ
preparas.stage = stage
preparas.nclass = 2
preparas.ndim = '3D_LabelHot'
preparas.issubtract = 0

kerasparas = KerasParas()
kerasparas.outID = 0
kerasparas.thd = 0.5
kerasparas.loss = 'dice_coef_loss'
organids = [1]

kerasparas.imgformat = 'channels_last'
kerasparas.modelname = '3D_Unet'
"""------------------------------------"""

kerasparas.modelpath = '/media/shuaiw/DataDisk/S_Wang_Research/P_Liming_RatBrain_Extraction/ModelZoo/Rat_Brain-2D_Unet-77-0.9731-0.9713.hdf5' ## Path to model

# eva.online_seg_evaluation(imgpath,labelpath,savepath,preparas,normparas,organids,kerasparas)
eva.online_seg_prediction(imgpath,savepath,preparas,normparas,organids,kerasparas)
